home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / util / time / backclock.lha / BackClock / sources / notify.c < prev    next >
C/C++ Source or Header  |  1998-02-06  |  992b  |  32 lines

  1. #include <libraries/notifyintuition.h>
  2. #include <exec/memory.h>
  3.  
  4. #include <proto/exec.h>
  5. #include <string.h>
  6. #include <stdio.h>
  7. #include "utils.h"
  8.  
  9. #define SCREEN "#?"
  10.  
  11. void startNotify(idWin * prj) {
  12.   /* initialise la notification
  13.    */
  14.   if ((prj->Notify->inr_Name  = AllocVec(strlen(SCREEN), MEMF_PUBLIC)) != NULL ){
  15.     if ((prj->notifyPort      = CreateMsgPort()) != NULL) {
  16.       strcpy(prj->Notify->inr_Name, SCREEN) ;
  17.       prj->Notify->inr_Flags         = INRF_SEND_MESSAGE|INRF_WAIT_REPLY|INRF_BEFORE_CLOSEWORKBENCH|INRF_AFTER_OPENWORKBENCH ;
  18.       prj->Notify->inr_stuff.inr_Msg.inr_Port          = prj->notifyPort ;
  19.       prj->Notify->inr_Pri           = 101 ;
  20.       prj->Notify->inr_UniqueID      = 'MYCL' ;
  21.   
  22.       NotIStartNotify(prj->Notify) ;
  23.     }
  24.   }
  25. }
  26.  
  27. void endNotify(idWin * prj) {
  28.   
  29.   if (prj->Notify)           NotIEndNotify(prj->Notify) ;
  30.   if (prj->notifyPort)       DeleteMsgPort(prj->notifyPort) ; 
  31.   if (prj->Notify->inr_Name) FreeVec(prj->Notify->inr_Name) ;
  32. }